import QtQuick 2.0
import QtQuick.Controls 1.1
import "../FKWidget/"
import "../FKWidgets/"

FKVisualInterface{
    id:vi

    layer.enabled: true

    signal chatMessage(var msg)
    signal startRequested
    signal quitRequested
    signal areaClicked(var x,var y)

    signal eClearChatHistory
    onEClearChatHistory: chatBoard.clearBoard()
    signal eAddChatMessage(var msg)
    onEAddChatMessage: chatBoard.addMessage(msg)
    signal eSetActorsOptions(var col, var m)
    onESetActorsOptions: room.setColumnOptionsModel(col,m)
    signal eStartLoading(var val1, var val2)
    onEStartLoading: room.startLoading(val1,val2)
    signal eSetLoadingProgress(var val1, var val2)
    onESetLoadingProgress: room.setLoadingProgress(val1,val2)
    signal eAddLoadingProgress(var val1, var val2)
    onEAddLoadingProgress: room.addLoadingProgress(val1,val2)
    signal eRoomStarted
    onERoomStarted:{room.hide();mainArea.enabled=true;scoreBoard.visible=true;}

    Item{
        id:screenArea
        property var topLevelWidget:null
        anchors{
            top:parent.top
            left:parent.left
            right:keyboard.left
            bottom:chatBoard.top
            bottomMargin:4
        }
        MouseArea{
            id:mainArea
            anchors.fill:parent
            enabled: false
            onClicked: vi.areaClicked(mouse.x,mouse.y)
        }
        FKRoomWidget{
            id:room
            onStart: startRequested()
            onQuit: quitRequested()
        }
        Button{
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            text:qsTr("Quit room")
            onClicked: quitRequested()
        }
        FKScoreBoard{
            id:scoreBoard
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.margins: 10
            visible: false
        }
    }
    FKVirtualKeyboard{
        id:keyboard
        anchors{
            top:parent.top
            right:parent.right
            bottom:chatBoard.top
            bottomMargin: 4
        }
        onButtonPressed: vi.virtualKeyPressed(b,txt)
    }
    FKChatBoard{
        id:chatBoard
        onChatMessage: vi.chatMessage(msg)
    }
    Component.onCompleted: room.show()
}

    
    
    
    
